package com.nanrui.mutualinductor.domains;

import com.nanrui.mutualinductor.data.DKPowerData;

import java.math.RoundingMode;
import java.text.DecimalFormat;

//CT传统法误差测试Info
public class FhwtRegulationTransformerViewInfo {
    public static final short STATUS_FINISH = 3;
    public static final short STATUS_NONE = 1;
    public static final short STATUS_START = 2;
    private static final double UPPER_LIMIT = Math.pow(10.0D, 8.0D);
    private String[] iErrors = new String[9];
    private String[] iRoundErrors = new String[9];
    private short mGrade;
    private float mMiniLoad;
    private float mPhaseAngle;
    private float mRatedLoad;
    private float mRatedPrimary;
    private float mRatedSecondary;
    //0无状态 1已设置 2启动 3测量完成
    private short mStatus = 0;
    private static final DecimalFormat p0Formatter = new DecimalFormat("#0");
    private static final DecimalFormat p1Formatter = new DecimalFormat("#0.0");
    private static final DecimalFormat p2Formatter = new DecimalFormat("#0.00");
    private static final DecimalFormat p3Formatter = new DecimalFormat("#0.000");
    private String[] phaseDisps = new String[9];
    private String[] phaseRoundDisps = new String[9];
    private float[] sIErrors;
    private float[] sIRoundErrors;
    private float[] sPhaseDisps;
    private Float sPhaseError;
    private float[] sPhaseRoundDisps;
    private Float sQuadratureError;
    private Short sResult;
    private Float sSecondaryR;
    private Float sWorkingVoltage;

    static {
        p0Formatter.setRoundingMode(RoundingMode.HALF_DOWN);
        p1Formatter.setRoundingMode(RoundingMode.HALF_DOWN);
        p2Formatter.setRoundingMode(RoundingMode.HALF_DOWN);
        p3Formatter.setRoundingMode(RoundingMode.HALF_DOWN);
    }

    public boolean getIsNotRunning() {
        boolean isRunning = false;
        if (mStatus != 1) {
            if (this.mStatus == 2) {
                isRunning = true;
            }
        }
        return isRunning;
    }

    public String getMGrade() {
        return DKPowerData.CTGrade.getStringByNumber(this.mGrade);
    }

    public String getMMiniLoad() {
        StringBuilder localStringBuilder = new StringBuilder();
        localStringBuilder.append(this.mMiniLoad);
//        localStringBuilder.append("VA");
        return localStringBuilder.toString();
    }

    public String getMPhaseAngle() {
        StringBuilder localStringBuilder = new StringBuilder();
        localStringBuilder.append(this.mPhaseAngle);
        localStringBuilder.append("");
        return localStringBuilder.toString();
    }

    public String getMRatedLoad() {
        StringBuilder localStringBuilder = new StringBuilder();
        localStringBuilder.append(this.mRatedLoad);
//        localStringBuilder.append("VA");
        return localStringBuilder.toString();
    }

    public String getMRatedPrimary() {
//        if (this.mRatedSecondary == 1.0F) {
//            return DKPowerData.CT1ndCurrentFor1.getStringByNumber(this.mRatedPrimary);
//        }
//        if (this.mRatedSecondary == 5.0F) {

        if (mRatedPrimary == 0) {
            return "";
        }
        try {
            return DKPowerData.CT1ndCurrentFor5.getStringByNumber(this.mRatedPrimary);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
//        }
//        return this.mRatedPrimary + "";

//        StringBuilder localStringBuilder = new StringBuilder();
//        localStringBuilder.append(this.mRatedPrimary);
//        localStringBuilder.append("A");
//        return localStringBuilder.toString();
//        return null;
    }

    public String getMRatedSecondary() {
        if (mRatedSecondary == 0) {
            return "";
        }
        try {
            return DKPowerData.CT2ndCurrent.getStringByNumber(this.mRatedSecondary);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }

    public String getMeasureStatus() {
        String str;
        if (this.mStatus == 2) {
            str = "停止";
        } else {
            str = "启动";
        }
        return str;
    }

    public String[] getSIErrors() {
        if (this.sIErrors == null) {
            return new String[9];
        }
        for (int i = 0; i < this.sIErrors.length; i++) {
            String[] arrayOfString = this.iErrors;
            String str;
            if (this.sIErrors[i] < UPPER_LIMIT) {
                str = this.p3Formatter.format(Float.valueOf(this.sIErrors[i]));
            } else {
                str = "";
            }
            arrayOfString[i] = str;
        }
        return this.iErrors;
    }

    public String[] getSIRoundErrors() {
        if (this.sIRoundErrors == null) {
            return new String[9];
        }
        for (int i = 0; i < this.sIRoundErrors.length; i++) {
            String[] arrayOfString = this.iRoundErrors;
            String str;
            if (this.sIRoundErrors[i] < UPPER_LIMIT) {
                str = this.p2Formatter.format(Float.valueOf(this.sIRoundErrors[i]));
            } else {
                str = "";
            }
            arrayOfString[i] = str;
        }
        return this.iRoundErrors;
    }

    public String[] getSPhaseDisps() {
        if (this.sPhaseDisps == null) {
            return new String[9];
        }
        for (int i = 0; i < this.sPhaseDisps.length; i++) {
            String[] arrayOfString = this.phaseDisps;
            String str;
            if (this.sPhaseDisps[i] < UPPER_LIMIT) {
                str = this.p1Formatter.format(Float.valueOf(this.sPhaseDisps[i]));
            } else {
                str = "";
            }
            arrayOfString[i] = str;
        }
        return this.phaseDisps;
    }

    public String getSPhaseError() {
        Object localObject;
        if ((this.sPhaseError != null) && (!Float.isNaN(this.sPhaseError.floatValue()))) {
            localObject = new StringBuilder();
            ((StringBuilder) localObject).append(this.p3Formatter.format(this.sPhaseError));
            ((StringBuilder) localObject).append("%");
            localObject = ((StringBuilder) localObject).toString();
        } else {
            localObject = "";
        }
        return (String) localObject;
    }

    public String[] getSPhaseRoundDisps() {
        if (this.sPhaseRoundDisps == null) {
            return new String[9];
        }
        for (int i = 0; i < this.sPhaseRoundDisps.length; i++) {
            String[] arrayOfString = this.phaseRoundDisps;
            String str;
            if (this.sPhaseRoundDisps[i] < UPPER_LIMIT) {
                str = this.p0Formatter.format(Float.valueOf(this.sPhaseRoundDisps[i]));
            } else {
                str = "";
            }
            arrayOfString[i] = str;
        }
        return this.phaseRoundDisps;
    }

    public String getSQuadratureError() {
        Object localObject;
        if ((this.sQuadratureError != null) && (!Float.isNaN(this.sQuadratureError.floatValue()))) {
            localObject = new StringBuilder();
            ((StringBuilder) localObject).append(this.p3Formatter.format(this.sQuadratureError));
            ((StringBuilder) localObject).append("%");
            localObject = ((StringBuilder) localObject).toString();
        } else {
            localObject = "";
        }
        return (String) localObject;
    }

    public String getSResult() {
        String str;
        if ((this.sResult != null) && (this.sResult.shortValue() != 2)) {
            if (this.sResult.shortValue() == 0) {
                str = "合格！";
            } else {
                str = "不合格！";
            }
        } else {
            str = null;
        }
        return str;
    }

    public String getSSecondaryR() {
        Object localObject;
        if ((this.sSecondaryR != null) && (!Float.isNaN(this.sSecondaryR.floatValue()))) {
            localObject = new StringBuilder();
            ((StringBuilder) localObject).append(this.p2Formatter.format(this.sSecondaryR));
            ((StringBuilder) localObject).append("Ω");
            localObject = ((StringBuilder) localObject).toString();
        } else {
            localObject = "";
        }
        return (String) localObject;
    }

    public String getSWorkingVoltage() {
        Object localObject;
        if ((this.sWorkingVoltage != null) && (!Float.isNaN(this.sWorkingVoltage.floatValue()))) {
            localObject = new StringBuilder();
            ((StringBuilder) localObject).append(this.p2Formatter.format(this.sWorkingVoltage));
            ((StringBuilder) localObject).append("V");
            localObject = ((StringBuilder) localObject).toString();
        } else {
            localObject = "";
        }
        return (String) localObject;
    }

    public short getmGrade() {
        return this.mGrade;
    }

    public float getmMiniLoad() {
        return this.mMiniLoad;
    }

    public float getmPhaseAngle() {
        return this.mPhaseAngle;
    }

    public float getmRatedLoad() {
        return this.mRatedLoad;
    }

    public float getmRatedPrimary() {
        return this.mRatedPrimary;
    }

    public float getmRatedSecondary() {
        return this.mRatedSecondary;
    }

    public short getmStatus() {
        return this.mStatus;
    }

    public float[] getsIErrors() {
        return this.sIErrors;
    }

    public float[] getsIRoundErrors() {
        return this.sIRoundErrors;
    }

    public float[] getsPhaseDisps() {
        return this.sPhaseDisps;
    }

    public Float getsPhaseError() {
        return this.sPhaseError;
    }

    public float[] getsPhaseRoundDisps() {
        return this.sPhaseRoundDisps;
    }

    public Float getsQuadratureError() {
        return this.sQuadratureError;
    }

    public Short getsResult() {
        return this.sResult;
    }

    public Float getsSecondaryR() {
        return this.sSecondaryR;
    }

    public Float getsWorkingVoltage() {
        return this.sWorkingVoltage;
    }

    public FhwtRegulationTransformerViewInfo setmGrade(short paramShort) {
        this.mGrade = ((short) paramShort);
//        notifyPropertyChanged(152);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmMiniLoad(float paramFloat) {
        this.mMiniLoad = paramFloat;
//        notifyPropertyChanged(61);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmPhaseAngle(float paramFloat) {
        this.mPhaseAngle = paramFloat;
//        notifyPropertyChanged(48);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmRatedLoad(float paramFloat) {
        this.mRatedLoad = paramFloat;
//        notifyPropertyChanged(129);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmRatedPrimary(float paramFloat) {
        this.mRatedPrimary = paramFloat;
//        notifyPropertyChanged(88);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmRatedSecondary(float paramFloat) {
        this.mRatedSecondary = paramFloat;
//        notifyPropertyChanged(114);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setmStatus(short paramShort) {
        this.mStatus = ((short) paramShort);
//        notifyPropertyChanged(47);
//        notifyPropertyChanged(191);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsIErrors(float[] paramArrayOfFloat) {
        this.sIErrors = paramArrayOfFloat;
//        notifyPropertyChanged(130);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsIRoundErrors(float[] paramArrayOfFloat) {
        this.sIRoundErrors = paramArrayOfFloat;
//        notifyPropertyChanged(131);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsPhaseDisps(float[] paramArrayOfFloat) {
        this.sPhaseDisps = paramArrayOfFloat;
//        notifyPropertyChanged(69);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsPhaseError(Float paramFloat) {
        this.sPhaseError = paramFloat;
//        notifyPropertyChanged(177);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsPhaseRoundDisps(float[] paramArrayOfFloat) {
        this.sPhaseRoundDisps = paramArrayOfFloat;
//        notifyPropertyChanged(154);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsQuadratureError(Float paramFloat) {
        this.sQuadratureError = paramFloat;
//        notifyPropertyChanged(187);
        return this;
    }

    public void setsResult(Short paramShort) {
        this.sResult = paramShort;
//        notifyPropertyChanged(145);
    }

    public FhwtRegulationTransformerViewInfo setsSecondaryR(Float paramFloat) {
        this.sSecondaryR = paramFloat;
//        notifyPropertyChanged(91);
        return this;
    }

    public FhwtRegulationTransformerViewInfo setsWorkingVoltage(Float paramFloat) {
        this.sWorkingVoltage = paramFloat;
//        notifyPropertyChanged(122);
        return this;
    }

    private String  testCompany;
    private String  madeCompany;
    private String  taskNumber;
    private String time;
    private String name;
    private String num;
    private String address;
    private String tem;
    private String hum;
    private String  devciceName;
    private String  deviceType;

    public String getDevciceName() {
        return devciceName;
    }

    public void setDevciceName(String devciceName) {
        this.devciceName = devciceName;
    }

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    public String getTem() {
        return tem;
    }

    public void setTem(String tem) {
        this.tem = tem;
    }

    public String getHum() {
        return hum;
    }

    public void setHum(String hum) {
        this.hum = hum;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }


    public String getTestCompany() {
        return testCompany;
    }

    public void setTestCompany(String testCompany) {
        this.testCompany = testCompany;
    }

    public String getMadeCompany() {
        return madeCompany;
    }

    public void setMadeCompany(String madeCompany) {
        this.madeCompany = madeCompany;
    }

    public String getTaskNumber() {
        return taskNumber;
    }

    public void setTaskNumber(String taskNumber) {
        this.taskNumber = taskNumber;
    }
}

